var mongoose = require('mongoose');
var option = require('./option');
var dataLink = function(){
    var data = require('./index');
    try{
        var db = mongoose.connect('mongodb://'+ option.user +':'+ option.password +'@'+ option.host +':'+ option.port +'/'+ option.db);
        data.db = db;
        data.model = require('./model');
    }catch (err){
        console.log(err);
    }
};

module.exports = dataLink;